{% extends "qa_base.html" %}
{% block content %}
<div id="wrapper">
    {% if query %}
    <div id="room">	
	        <div id="CALeft">
			    <div class="tabBar">
				    <div class="headQuestions">questions matching &#39;{{ query|escape }}&#39;</div> 
                    <div class="tabsA">
                    <!--not complete yet-->
        	            <a href="/qa/search/?q={{ query|escape }}&amp;t=question&amp;Submit=搜索&sort=effective" {%if content == 'effective' %}class="on"{%endif%} title="Most recently updated questions">有效</a>
        	            <a href="/qa/search/?q={{ query|escape }}&amp;t=question&amp;Submit=搜索&sort=newest_question" title="most recently asked questions"  {% if content == 'newest_question' %}class="on"{% endif %}>最新问题</a>
        	            <a href="/qa/search/?q={{ query|escape }}&amp;t=question&amp;Submit=搜索&sort=hot_question" title="most active questions in the last 24 hours" {% if content == 'hot_question' %}class="on"{% endif %}>热门问题</a>
        	            <a href="/qa/search/?q={{ query|escape }}&amp;t=question&amp;Submit=搜索&sort=mostvoted" title="most voted questions" {% if content == 'mostvoted' %} class="on" {% endif%} >最有价值的问题</a>
                    </div>
                </div>
                <div id="listA">
    	            {% if results %}
      	                {% for question in results %}	   
				            <div class="short-summary">
    			                <div class="counts">
        			                <div class="votes">
            		                    <div class="item-count">{{question.vote_count}}</div>
            		                    <div>票</div>
            	                    </div>
        		                    <div class="status  answered">
            		                    <div class="item-count">{{question.answered_count}}</div>
            		                    <div>回答</div>
            	                    </div>
        			                <div class="views">
            		                    <div class="item-count">{{question.view_count}}</div>
             		                    <div>浏览</div>
        			                </div>
        	                    </div>
    			                <div class="question-summary-wrapper">
        			                <h2><a title = "{{question.description}}" href="/qa/questions/{{question.id}}/">{{question.title}}</a></h2>
        			                <div class="userinfo">
                                    {% for lastanswer in lastanswerlist %}
                                     {% if forloop.parentloop.counter0 == forloop.counter0 %}
									 {% if lastanswer %}
            		                    <span class="relativetime" title="{{lastanswer.answer_datetime}}">{{lastanswer.answer_datetime|timesince}}前回答by</span>
  
            		                    <a href="/qa/questions/users/{{lastanswer.answerer.id}}/">{{lastanswer.answerer.name}}</a>
									{%endif%}							       
                                    {%if not lastanswer %}
                                    <div class="userinfo">  
                       发表于 <span class="relativetime" title="{{question.question_datetime}}">{{question.question_datetime|timesince}}</span>前提问by
                                <a href="/qa/questions/users/{{question.questioner.id}}/">{{question.questioner.name}}</a>
                            </div>
									{%endif%} 
									
									{% endif %}
									{% endfor %} 
								 </div>
        			                <div class="tags">
                                    {% for tag in question.tags.all %}
                                    <!--not complete yet-->
            		                    <a class="tag-link-{{tag.name}}" href="/qa/tags/{{tag.name}}/" title="查看有关 '{{tag.name}}'" rel="tag">{{tag.name|slice:':14'}}{%if tag.name|length >= 14 %}..{%endif%}</a>
                                    {% endfor %}
        			                </div>
    			                </div>
				            </div>
                        {% endfor %}
                    {% endif %}
			    </div>
		    </div>
		    <div id="CARight">     
    	        <div class="boxC">
    		        <div class="questions-count">{{resultscount}}<span style="color:black;font-size:14px;margin-left:5px">questions matching</span>
    		        </div>
    		        <div class="questions-count">{{ answerscount }}<span style="color:black;font-size:14px;margin-left:5px"> answers related</span>
    		        </div>
    		        <div>
    			        <p class="nomargin">Most <strong>recently updated</strong>questions</p>
    		        </div>
    	        </div>
    	        <!--<div id="sidebar-upper" class="boxC">
    		        <div class="body">
        	            <h2>芝麻招聘信息</h2>
					    <ol>
				            <li><a href="http://www.zhimaq.com/jobs/shiyu-tech/">仕宇网络招聘PHP程序员</a></li>
						    <li><a href="http://www.zhimaq.com/jobs/aliyun/">阿里云招聘Python开发工程师</a> </li>
					    </ol>
     		        </div>
			    </div>-->
    	        <div class="boxC">
                    <h3 class="subtitle">相关标签</h3>
                    <div class="tags" id="recent-tags">
        	            {% for tag in tags %}
                            {% for tagcount in tagscount %}
                                {% if forloop.parentloop.counter0 == forloop.counter0 %}
                                <a rel="tag" class="tag-link-{{tag.name}}" title="see questions tagged '{{tag.name}}'"  href="/qa/tags/{{tag.name}}/">{{tag.name|slice:':20'}}{%if tag.name|length >= 20 %}..{%endif%}</a>
                                <span class="tag-number">&#215; {{ tagcount }}</span>
                                <br />
                                {% endif %}
                            {% endfor %}
                        {% endfor %}
                    </div>
    	        </div>
            </div>
            <div id="tail" style="clear:both;">      
    	<div class="pager">
            <p class="paginator">
                {% if LastNum >= 1 %}
                <span class="next"><a href="/qa/search/pages/{{LastNum}}/?q={{ query|escape }}&amp;t=question&amp;Submit=搜索" title="上一页">&laquo; 上一页</a></span>
                {% endif %}
                {% for PageNum in PageList%}
                {% if PageNum == CurrentNum %}
                <span class="curr this_page" >{{PageNum}}</span>
                {% else %}
                <a class="page" href="/qa/search/pages/{{PageNum}}/?q={{ query|escape }}&amp;t=question&amp;Submit=搜索" >{{PageNum}}</a>
                {% endif %}
                {% endfor %}
                {% if NextNum <= PageTotalNum %}
                <span class="next"><a href="/qa/search/pages/{{NextNum}}/?q={{ query|escape }}&amp;t=question&amp;Submit=搜索" title="下一页">下一页 &raquo;</a></span>
                {% endif %}
               <!-- <span class="curr this_page">1</span>
                <a class="page" href="/search/?q=django&t=question&sort=有效&page=2" >2</a>
                <a class="page" href="/search/?q=django&t=question&sort=有效&page=3" >3</a>
                <span class="next"><a href="/search/?q=django&t=question&sort=有效&page=2" title="下一页">下一页 &raquo;</a></span>-->
            </p>
        </div>
    	<!--<div class="pagesize">
    		<div class="paginator">
    			<span class="text">每页显示：</span>
    			<span class="page"><a href="/qa/search/?q=%E6%A8%A1%E5%9E%8B&amp;t=question&amp;Submit=%E6%90%9C%E7%B4%A2&sort=有效&pagesize=15">15</a></span>
    			<span class="curr">30</span>
    			<span class="page"><a href="/qa/search/?q=%E6%A8%A1%E5%9E%8B&amp;t=question&amp;Submit=%E6%90%9C%E7%B4%A2&sort=有效&pagesize=50">50</a></span>
    		</div>
    	</div>-->
    </div>
    </div>
    <div class="spacer3"></div>
    {% endif %}
</div>
{% endblock %}
